import http from '@/common/http'
import { getStorage, setStorage } from '@/common/utils/storage'

export const getVisitorData = async () => {
  const key = 'visitorData'
  let data = getStorage(key)
  console.debug(data)
  if (data) return data
  const res = await http.get('uuid/getUUID')
  data = {
    userId: res.data,
    userName: '测试访客',
    userAvatar: 'http://8.129.39.183:8080/uploadFile/girl.jpg'
  }
  setStorage(key, data)
  return data
}
